// Composables
import { createRouter, createWebHistory } from "vue-router";
//路由表
const routes = [
  //当路由为空时，重定向到登录页面
  {
    path: "/",
    redirect: "/Login",
  },
  //登录页面
  {
    path: "/Login",
    name: "Login",
    component: () => import("../views/Login.vue"),
  },
  //注册页面
  {
    path: "/Register",
    name: "Register",
    component: () => import("../views/Register.vue"),
  },
  //首页
  {
    path: "/HomePage",
    name: "HomePage",
    component: () => import("../views/HomePage.vue"),
    children: [
      {
        path: 'DebateDashBoard',
        component: () => import("../views/DebateDashBoard.vue")
      },{
        path: "Chat",
        name: "Chat",
        component: () => import("../views/Chat.vue"),
        meta: { keepAlive: false } 

      },{
        path: "BasicInfo",
        name: "BasicInfo",
        component: () => import("../views/BasicInfo.vue"),
      },{
        path: "ChatPage",
        name: "ChatPage",
        component: () => import("../views/ChatPage.vue"),
      }, {
        path: 'HistoryPage',
        name: 'HistoryPage',
        component: () => import('../views/HistoryPage.vue'),
      },{
        path: 'UserProfile',
        name: 'UserProfile',
        component: () => import('../views/UserProfile.vue')
      },
      {
        path:"BlogVerify",
        name:"BlogVerify",
        component: ()=> import("../views/BlogVerify.vue")
      },
      {
        path:"LogMonitor",
        name:"LogMonitor",
        component: ()=> import("../views/LogMonitor.vue")
      }
      //社区
      // {
      //   path: "Community",
      //   name: "Community",
      //   component: () => import("../views/Community.vue")
      // },

    ]
  },
  //websocket测试
  {
    path: "/websocket",
    name: "websocket",
    component: () => import("../views/websocket.vue"),
  },
  // {
  //   path: "/ChatPage",
  //   name: "ChatPage",
  //   component: () => import("../views/ChatPage.vue"),
  // },
  {
    path: "/StudyPage",
    name: "StudyPage",
    component: () => import("../views/StudyPage.vue"),
  },
  //社区
  {
    path: "/Community",
    name: "Community",
    component: () => import("../views/Community.vue")
  },
  //帖子详情
  {
    path: "/post/:id",
    name: "PostDetail",
    component: () => import("../views/PostDetail.vue"),
    props: true
  }

];
//路由创建
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});
//路由导出
export default router;
